We want player1 to hit the ball across the net when the hedgehog and ball collide.

  • Add Collision with Shape to your program. Change the name at the start of the event handler to player1.
  • Change the first if statement to test for colliding with "blue". Delete the second if statement and its command.
  • Change the command under the first if statement to .set_x_speed() of the hit_sprite to 4.
  • Add another command under the same if statement to .set_y_speed() of the hit_sprite to 5.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)